<template>
	<view>
		<template v-if="loadingFlag">
			<view class="loadingTxt">
				<loading></loading>
			</view>
		</template>
		<template v-else>
			<view class="proSwiper">
				<swiper class="swipers posAbso ltzero defBg" :indicator-dots="dotsFlag" indicator-color="rgba(255,255,255,.3)"
					indicator-active-color="#ffffff" :autoplay="autoplayFlag" :circular="circularFlag">
					<swiper-item class="swiper-item" v-for="(item,index) in albumList" :key="index" @tap="previewImage(index)">
						<image class="samePar" :src="item" mode="aspectFill"></image>
					</swiper-item>
				</swiper>
			</view>
			<view class="profileWrap">
				<view class="profile">
					<view class="fileTit">机构名称</view>
					<view class="fileCon" v-if="list.ogzName != undefined">{{(list.ogzName)}}</view>
				</view>
				<view class="profile">
					<view class="fileTit">机构联系人</view>
					<view class="fileCon">
						<text class="tills">{{list.lxName}}</text>
						<text class="till">|</text>
						<text>{{list.lxTel}}</text>
					</view>
				</view>
				<view class="profile">
					<view class="fileTit">工作时间</view>
					<view class="fileCon">
						<text class="tills">{{list.workTime}}</text>
					</view>
				</view>
				<view class="profile">
					<view class="fileTit">服务领域</view>
					<view class="fileCon clearfix">
						<view class="tagItem" v-for="(item,index) in fwRangeArr" :key="index">{{item}}</view>
					</view>
				</view>
				<view class="profile posRel">
					<view class="fileTit">机构地址</view>
					<view class="fileCon spec">{{list.address}}</view>
				</view>
				<view class="profile posRel">
					<view class="fileTit">机构介绍</view>
					<view class="fileCon">{{list.ogzProfile}}</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import { getOgzDetByWxAppId } from '@/api/wxsign/index.js';
	export default {
		data(){
			return{
				loadingFlag:true,
				ogzId:'',
				list:null,
				fwRangeArr:[],
				albumList:[],
				dotsFlag:true,
				autoplayFlag:true,
				circularFlag:true,
			}
		},
		onLoad(){
			this.ogzId = uni.getStorageSync('mpOgzId');
			this.loadOgzDet();
		},
		methods:{
			loadOgzDet(){
				this.loadingFlag = true;
				let field = { id:this.ogzId,lon:'',lat:'' };
				getOgzDetByWxAppId(field).then(res=>{
					this.loadingFlag = false;
					this.list = res.data.datas;
					this.fwRangeArr = this.list.sysRange.split(',');
					let photoList = this.list.pList;
					if(photoList.length > 0){
						for(let i in photoList) {
							if(photoList[i].zlImg.startsWith('http')){
								this.albumList.push(photoList[i].zlImg);
							}else{
								this.albumList.push(this.cloudUrl + photoList[i].zlImg);
							}
						}
					}else{
						let tmpHeadImg = this.getCloudFilePath(this.list.ogzImg);
						this.albumList.push(tmpHeadImg)
					}
					
				}).catch(err=>{
					this.loadingFlag = false;
					console.log(err);
				});
			},
			previewImage(index){
				var current = this.albumList[index];
				uni.previewImage({
					current: current,
					urls: this.albumList
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.proSwiper{
		width: 100%;
		height: 400rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		position: relative;
	}
	.proSwiper .swipers{
		width: 100%;
		height: 100%;
	}
	.proSwiper .swipers .swiper-item{
		border-radius: $pss-border-radius6;
	}
	.tagItem{
		height: 40rpx;
		line-height: 40rpx;
		padding: 0 15rpx;
		border-radius: 8rpx; 
		background: #fff7ea;
		color: $pss-color-primary_1;
		font-size: $font-size26;
		float: left;
		margin-right: 15rpx;
	}
	.groupService{
		width: 690rpx;
		/* height: 136rpx; */
		margin-top: 30rpx;
		display: flex;
		justify-content: space-between;
		.ogzImg{
			width: 330rpx;
			height: 160rpx;
		}
	}
	.profileWrap{
		padding:0 30rpx 120rpx;
	}
	.profile{
		border-bottom: 1rpx solid #eee;
		padding:10rpx 0 20rpx;
		.fileTit{
			height: 60rpx;
			line-height: 60rpx;
			font-size: $font-size28;
			color: $pss-text-color3;
		}
		.fileCon{
			font-size: $font-size26;
			color: $pss-text-color8;
			.tills{
				margin-left: 10rpx;
			}
			.till{
				margin: 0 10rpx;
			}
			&.spec{
				width: 90%;
			}
		}
		.iconWrap{
			width: 50rpx;
			height: 50rpx;
			line-height: 50rpx;
			background: #e5faf5;
			border-radius: 50%;
			text-align: center;
			position: absolute;
			right: 0;
			top: 60rpx;
			.icon-daohang{
				color: $pss-color-green;
				font-size: $font-size30;
			}
		}
	}
</style>